﻿<?xml version="1.0" encoding="utf-8"?>

<!--  
  If you change this file you will need to regenerate the class definition.  
  Run the following from a visual studio command prompt (so that xsd.exe is in your path):
  
  cd <folder containing this xsd file>
  xsd.exe /classes /n:ZYO.Database /o:.\ ZYODatabaseXml.xsd
-->
<xs:schema targetNamespace="http://tempuri.org/ZYO" xmlns="http://tempuri.org/ZYO" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:include schemaLocation="..\Persistence\ZYOBaseXml.xsd"/>
  <xs:include schemaLocation="..\Persistence\ZYORules.xsd"/>
  
  <xs:complexType name="天干">
    <xs:attribute name="枚举值" type="enum天干" use="required"/>
    <xs:attribute name="五行属性de枚举值" type="enum五行" use="required"/>
 </xs:complexType>

  <xs:complexType name="地支">
    <xs:attribute name="枚举值" type="enum地支" use="required"/>
    <xs:attribute name="地蔵天干" type="xs:string" use="required"/>
    <xs:attribute name="五行属性de枚举值" type="enum五行" use="required"/>
  </xs:complexType>

  <xs:complexType name="月建旺相">
    <xs:attribute name="月地支" type="enum地支" use="required"/>
    <xs:attribute name="旺相值" type="e月建旺相" use="required"/>
  </xs:complexType>
  
  <xs:complexType name="地支旺相">
    <xs:sequence>
      <xs:element minOccurs="12" maxOccurs="12"  name="月建" type="月建旺相"/>
    </xs:sequence>
    <xs:attribute name="地支" type="enum地支" use="required"/>
  </xs:complexType>

  <xs:complexType name="生旺库绝">
    <xs:attribute name="地支" type="enum地支" use="required"/>
    <xs:attribute name="旺相值" type="e生旺库绝" use="required"/>
  </xs:complexType>

  <xs:complexType name="五行之地支生旺">
    <xs:sequence>
      <xs:element minOccurs="12" maxOccurs="12"  name="地支" type="生旺库绝"/>
    </xs:sequence>
    <xs:attribute name="五行" type="enum五行" use="required"/>
  </xs:complexType>
  
  <xs:complexType name="甲子">
    <xs:attribute name="枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="纳音" type="xs:string" use="optional"/>
  </xs:complexType>

  <xs:complexType name="节气">
    <xs:attribute name="枚举值" type="enum节气" use="required"/>
    <xs:attribute name="节气日期" type="xs:dateTime" use="required"/>
    <xs:attribute name="JQBaseTime1996" type="xs:dateTime" use="required"/>
    <xs:attribute name="上元之局" type="xs:byte" use="required"/>
    <xs:attribute name="中元之局" type="xs:byte" use="required"/>
    <xs:attribute name="下元之局" type="xs:byte" use="required"/>
    <xs:attribute name="iLocation" type="xs:byte" use="required"/>
  </xs:complexType>

  <xs:complexType name="九宫八卦">
    <xs:attribute name="枚举值" type="enum八卦ID" use="required"/>
    <xs:attribute name="先天数de枚举值" type="enum先天八卦" use="required"/>
    <xs:attribute name="方向" type="xs:string" use="required"/>
    <xs:attribute name="下卦地支de枚举值" type="enum地支" use="required"/>
    <!--<xs:attribute name="上卦地支de枚举值" type="enum地支" use="required"/>-->
    <xs:attribute name="五行属性de枚举值" type="enum五行" use="required"/>
    <xs:attribute name="阴阳" type="xs:boolean" use="required"/>
  </xs:complexType>

  <xs:complexType name="易经爻辞">
    <xs:sequence>
      <xs:element minOccurs="6" maxOccurs="6"  name="爻辞" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="六十四卦de枚举值" type="enum六十四卦ID" use="required"/>
  </xs:complexType>

  <xs:complexType name="六十四卦">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1"  name="卦象" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="彖曰" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="象曰" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="枚举值" type="enum六十四卦ID" use="required"/>
    <xs:attribute name="周易序号" type="enum六十四卦by数" use="required"/>
    <xs:attribute name="世爻" type="xs:byte"  use="required"/>
    <xs:attribute name="八卦卦宫" type="xs:byte"  use="required"/>
  </xs:complexType>

  <xs:complexType name="字库">
    <xs:attribute name="字" type="xs:string" use="required"/>
    <xs:attribute name="笔画" type="xs:short" use="required"/>
  </xs:complexType>
  
  <xs:complexType name="Tables">
    <xs:sequence>
      <xs:element minOccurs="10" maxOccurs="10"  name="天干Table" type="天干" />
      <xs:element minOccurs="12" maxOccurs="12"  name="地支Table" type="地支" />
      <xs:element minOccurs="12" maxOccurs="12"  name="地支旺相Table" type="地支旺相" />
      <xs:element minOccurs="5" maxOccurs="5"  name="五行生旺库绝Table" type="五行之地支生旺" />
      <xs:element minOccurs="60" maxOccurs="60"  name="甲子Table" type="甲子" />
      <xs:element minOccurs="24" maxOccurs="24"  name="节气Table" type="节气" />      
      <xs:element minOccurs="8" maxOccurs="8" name="八卦Table" type="九宫八卦"/>
      <xs:element minOccurs="64" maxOccurs="64" name="六十四卦Table" type="六十四卦"/>
      <xs:element minOccurs="64" maxOccurs="64" name="易经爻辞Table" type="易经爻辞"/>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="字库Table" type="字库"/>      
    </xs:sequence>
    <xs:attribute name="Version" type="xs:decimal" use="optional"/>
    <xs:attribute name="LastUpdateDate" type="xs:date" use="optional"/>
  </xs:complexType>  
  
  <xs:element name="Tables" type="Tables"/>

</xs:schema>
